from enthought.traits.api import HasTraits, Instance
from enthought.traits.ui.api import View, Item
from mpl_figure_editor import MPLFigureEditor, Figure

class MPLSimplePlot(HasTraits):

    figure = Instance(Figure, ())

    view = View(Item('figure', editor=MPLFigureEditor(),
                            show_label=False),
                    width=400,
                    height=300,
                    resizable=True)

    def __init__(self, figure):
        super(MPLSimplePlot, self).__init__()
        self.figure=figure
        self.figure.canvas.draw()
        